import Vue from 'vue'
import Router from 'vue-router'
import App from '@/App'
const home = () => import('@/pages/home')
const componentNotFound = () => import('@/pages/404')
const parentHeadline = () => import('@/pages/parentHeadline')
const lessonShare = () => import('@/pages/lessonShare')
const topicDetail = () => import('@/pages/topicDetail')
const informationDetail = () => import('@/pages/informationDetail')
const writeCommit = () => import('@/pages/writeCommit') // 写评论
const informationDetailH5 = () => import('@/pages/informationDetail-h5')
const dashboardH5 = () => import('@/pages/dashboard-h5')
const example = () => import('@/pages/demo')
const courseDetailH5 = () => import('@/pages/courseDetail-h5')
const subjectDetailH5 = () => import('@/pages/subjectDetail-h5')
const question = () => import('@/pages/question')
const specialist = () => import('@/pages/specialist')
const summerCamp = () => import('@/pages/summerCamp')
const schoolNewsDetail = () => import('@/pages/schoolNewsDetail')

Vue.use(Router)

export default new Router({
  mode: 'history',
  scrollBehavior(to, from, savedPosition) {
    return { x: 0, y: 0 }
  },
  routes: [
    {
      path: '/',
      component: App,
      children: [
        {
          path: '',
          name: 'home',
          component: home
        },
        {
          path: '/parentHeadline',//家长头条
          component: parentHeadline
        },
        {
          path: '/lessonShare',//课程观看
          component: lessonShare,
          name: 'lessonShare'
        },
        {
          path: '/topicDetail',//话题详情
          component: topicDetail
        },
        {
          path: '/informationDetail',//资讯详情APP
          component: informationDetail
        },
        {
          path: '/writeCommit',//资讯详情APP -- 写评论
          component: writeCommit
        },
        {
          path: '/informationDetail-h5',//资讯详情H5
          component: informationDetailH5
        },
        {
          path: '/question',//问答详情
          component: question
        },
        {
          path: '/specialist',//专家首页
          component: specialist
        },
        {
          path: '/dashboard-h5',//dashboardH5
          component: dashboardH5
        },
        {
          path: '/demo',
          component: example
        },
        {
          path: '/courseDetail-h5', // 课程详情分享
          component: courseDetailH5
        },
        {
          path: '/subjectDetail-h5', // 专题详情分享
          component: subjectDetailH5
        },
        {
          path: '/summerCamp', // 夏令营
          component: summerCamp
        },
        {
          path: '/schoolNewsDetail', // 获取院校动态详情
          component: schoolNewsDetail
        },
      ]
    },
    {
      //404 页面
      path: '*',
      component: componentNotFound
    }
  ]
})
